home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
FNTPAK32.ZIP
/
C.EXE
/
DEMO_GFX.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-16
|
4KB
|
127 lines
/********************************************************************
Demo_GFX.C Copyright 1994, Rob W. Smetana
Turn Screen Swapping ON if appropriate.
Demonstrate how to:
1. Detect monitor type. We need EGA/VGA to change fonts.
2. Change fonts in GRAPHICS modes.
Requires:
a. Graphics.Lib
1. Video.Obj (which contains function GetMonitor)
2. Font_GFX.OBJ (graphics-mode default font routines)
3. Script1.OBJ (graphics- AND text-mode custom Script font)
********************************************************************/
#include <graph.h>
#include <dos.h>
#include <font_pak.h>
/* GetMonitor function is in video_c.obj */
extern int GetMonitor ();
void video_mode(int mode);
/* prototype for our callable Script font */
void extern pascal far SCRIPT1(int Block);
void extern pascal far GFXSCRIPT1(void);
int FontSize (); /* local get-monitor function to detect EGA/VGA
and return size of default font (14/16)
-or- print error message if appropriate
*/
int main (void)
{
int FSize, n;
FSize = FontSize (); /* FontSize returns 14, 16 or 0 (no EGA/VGA) */
if (FSize == 0) /* Bail out if no EGA/VGA */
return (-99);
_setvideomode(_TEXTC80);
printf(" Demonstrates CALLing fonts in Graphics Modes.\n");
printf(" These are the same fonts you can use in text mode.\n\n");
printf(" Press a key and we'll demonstrate several FONT SIZES at once!");
getch ();
_setvideomode(_ERESCOLOR);
for (n = 1; n < 15; ++n)
{
GFXFont08();
printf (" Here's the default 8x8,");
GFXSCRIPT1();
printf (" an 8x16 SCRIPT font,");
GFXFont14();
printf (" and the 8x14--on the SAME LINE!\n");
}
printf ("\n\n\n\n");
GFXFont14();
printf (" Note how easily you can change fonts in graphics -or- text modes. Also\n");
printf (" note that THREE fonts are printed on the SAME LINE above! But since font\n");
printf (" heights differ, line heights differ as well.\n\n");
printf (" Down here is the 8x14 font. So you're looking at 3 font sizes (8x8,\n");
printf (" 8x14 and 8x16) -- ALL ON THE SAME SCREEN!");
getch ();
_setvideomode(_DEFAULTMODE);
} /* end main */
/*******************************************************************
Function: FontSize
Purpose: Check for EGA/VGA and return 14 (EGA 8x14), 16 (VGA 8x16)
or 0 if we're not using an EGA/VGA
Print error message and end if no EGA/VGA
GetMonitor returns an integer (0 - 8) indicating the type of monitor
in use. If two monitors are being used, GetMonitor returns
the type of the primary monitor.
0 = None (no monitor) 3 = EGA (or MultiSync)
4 = Color (CGA) 5 = Monochrome
7 = VGA Monochrome 8 = VGA Color (or MultiSync)
*******************************************************************/
int FontSize ()
{
int MonType;
MonType = GETMONITOR();
switch (MonType) {
case 0, 4, 5: /* no monitor, Mono or CGA */
printf ("Sorry. An EGA or VGA monitor is required to run this demo. \n\n");
return (0);
break;
case 3: /* EGA. Set fontsize to 8x14 */
return (14);
break;
case 7, 8: /* VGA. Set fontsize to 8x16 */
return (16);
break;
default:
printf ("Unknown monitor type. Sorry. An EGA or VGA monitor is required to run this. \n\n");
return (0);
break;
}
}